<template>
  <div style="margin-bottom:20px">
    <FinancingChannel :infoAggrehation="infoAggrehation" @loan='goLoan'></FinancingChannel>
    <LoanProducts :productList="productList"></LoanProducts>
    <!-- <GuaranteedCredit></GuaranteedCredit> -->
    <TransactionDynamics :tradeList="tradeList"></TransactionDynamics>
    <PolicyInformation :policyInfo="policyInfo" :newsInfo="newsInfo"></PolicyInformation>
    <PlatformAdvantages></PlatformAdvantages>
    <FriendsshipLinks></FriendsshipLinks>
    <CoopertionOrganization></CoopertionOrganization>
  </div>
</template>

<script>
import store from '../store/index.js';
import {mapState} from 'vuex';

import FinancingChannel from "./homePageComp/financingChannel.vue";//融资通道
import LoanProducts from "./homePageComp/loanProducts.vue";//贷款产品
// import GuaranteedCredit from "./homePageComp/guaranteedCredit.vue";//增信担保
import TransactionDynamics from "./homePageComp/transactionDynamics.vue";//交易动态
import PolicyInformation from "./homePageComp/policyInformation.vue";//政策资讯
import PlatformAdvantages from "./homePageComp/platformAdvantages.vue";//平台优势
import FriendsshipLinks from "./homePageComp/friendsshipLinks.vue";//友情链接
import CoopertionOrganization from "./homePageComp/coopertionOrganization.vue";//合作机构

export default {
  name: 'homePage',
  props:["tradeList","infoAggrehation","productList","policyInfo","newsInfo"],
  components: {
      FinancingChannel,
      LoanProducts,
      // GuaranteedCredit,
      TransactionDynamics,
      PolicyInformation,
      PlatformAdvantages,
      FriendsshipLinks,
      CoopertionOrganization
  },
  data(){
    return {
      // tradeList:[],
      // infoAggrehation:{},
      // productList:[],
      // policyInfo:[],
      // newsInfo:[]
    }
  },
  mounted(){
    // console.log(this.tradeList);
    // console.log("this is mounted interface");
    // console.log(this.addressInfo);
    // if(window.areaArr && window.areaArr.length){
      // this.getrelativeInfo();
    // }
  },
  methods:{
    goLoan(args){
      console.log(args)
      this.$axios('companyMsggetEntinfo',[],{
          userPhone:this.$token.getUUID()
      }).then(res=>{
          console.log(res)
          if(JSON.stringify(res.data.entInfo) == "{}"){
              this.$router.push({
                  path:'legalPerson',
              })
          }else{
              this.$router.push({
                  path:'nondircompanyMsg',
                  query:args
              })
          }
      })
    }
  },
  computed:{
    ...mapState(["addressInfo"]),
    // changeAreaInfo(){
    //   if(window.areaArr){
    //     this.getrelativeInfo();
    //     console.log("this is change something");
    //   }
    //   return null;
    // },
    // addressInfo(){
      // this.getrelativeInfo();
      // console.log(this.addressInfo,'this is address info');
      // return null;
    // }
  }
}
</script>
<style scoped>

</style>
